<template>
  <div style="height: 6vh;background-color:#fff;padding:10px 20px;">
    <span style="line-height:60px;font-size:20px;">我的包裹</span>
  </div>
  <div style="font-size: 20px" ><span style="background-color: rgb(255, 247, 230); border: 2px solid rgb(255, 213, 145);">提示：已选择 <span style="color: rgb(255, 0, 0)">{{multipleSelection.length}}</span> 件包裹</span>
    <el-button @click="merge">合并收货</el-button>
  </div>
  <el-tabs v-model="activeName" class="custom-tabs" style="font-size: 20px;"
  >
    <!--    <el-tabs v-model="activeName" class="demo-tabs" @tab-click="handleClick">-->
    <el-tab-pane label="待收货" name="first" >
      <!-- 待支付列表 搜索卡片 -->
      <el-card style="margin: 20px;">
        <el-form style="padding-top:10px;">
          <el-row :gutter="30">

            <el-col :span="4">
              <el-form-item label="快递单号">
                <el-input placeholder="请输入" v-model="searchMyPackage.mailCode"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="4">
              <el-form-item label="物品编号">
                <el-input placeholder="请输入物品编号" v-model="searchMyPackage.packageCode"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="4">
              <el-form-item label="配送方式">
                <el-select placeholder="请选择" v-model="searchMyPackage.getWay">
                  <!--                  <el-option v-for="item in appOptions" :label="item.label" :value="item.value"></el-option>-->
                  <el-option label="快递" value="10"></el-option>
                  <el-option label="自提" value="20"></el-option>
                  <el-option label="移到云仓" value="30"></el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col  v-if="false">
              <el-form-item label="状态">
                <el-input placeholder="请选择" v-model="searchMyPackage.status" value="0">
                </el-input>
              </el-form-item>
            </el-col>
            <el-col :span="4">
              <el-form-item>
                <el-button @click="resetSearch">重置</el-button>
                <el-button type="primary" @click="loadMyPackage">查询</el-button>
              </el-form-item>
            </el-col>

          </el-row>
        </el-form>
      </el-card>
      <!-- 待收货包裹表格 -->
      <el-card style="margin:20px">
        <el-table :data="tableData" @selection-change="handleSelectionChange">
          <el-table-column type="selection" width="55" />
          <el-table-column type="index" width="80" align="center" prop="id" label="编号"></el-table-column>
          <el-table-column align="center" prop="username" label="发货时间"></el-table-column>
          <el-table-column align="center" prop="departureAddr" label="快递单号"></el-table-column>
          <el-table-column align="center" prop="destinationAddr" label="物品数量"></el-table-column>
          <el-table-column align="center" prop="reason" label="物品金额"></el-table-column>
          <el-table-column align="center" prop="auditUsernameList" label="配送方式"></el-table-column>

          <el-table-column label="操作" width="120" align="center">
            <template #default="scope">
              <el-button type="primary" size="small" link
                         :disabled="scope.row.status!=10" @click="cancel(scope.row.id)">撤销
              </el-button>
            </template>
          </el-table-column>
        </el-table>

      </el-card>
    </el-tab-pane>

    <el-tab-pane label="已收货" name="second">
      <!-- 已支付列表 搜索卡片 -->
      <el-card style="margin: 20px;">
        <el-form style="padding-top:10px;">
          <el-row :gutter="30">

            <el-col :span="4">
              <el-form-item label="快递单号">
                <el-input placeholder="请输入" v-model="searchMyPackage.mailCode"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="4">
              <el-form-item label="物品编号">
                <el-input placeholder="物品编号" v-model="searchMyPackage.packageCode"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="4">
              <el-form-item label="配送方式">
                <el-select placeholder="请选择" v-model="searchMyPackage.getWay">
                  <!--                  <el-option v-for="item in appOptions" :label="item.label" :value="item.value"></el-option>-->
                  <el-option label="快递" value="10"></el-option>
                  <el-option label="自提" value="20"></el-option>
                  <el-option label="移到云仓" value="30"></el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col  v-if="false">
              <el-form-item label="状态">
                <el-input placeholder="请选择" v-model="searchMyPackage.status" value="1">
                </el-input>
              </el-form-item>
            </el-col>
            <el-col :span="4">
              <el-form-item>
                <el-button @click="resetSearch">重置</el-button>
                <el-button type="primary" @click="loadMyPackage">查询</el-button>
              </el-form-item>
            </el-col>
          </el-row>
        </el-form>
      </el-card>
      <!-- 订单表格 -->
      <el-card style="margin:20px">
        <el-table :data="tableData" @selection-change="handleSelectionChange">
          <el-table-column type="selection" width="55" />
          <el-table-column type="index" width="80" align="center" prop="id" label="编号"></el-table-column>
          <el-table-column align="center" prop="username" label="收货时间"></el-table-column>
          <el-table-column align="center" prop="departureAddr" label="快递单号"></el-table-column>
          <el-table-column align="center" prop="destinationAddr" label="物品数量"></el-table-column>
          <el-table-column align="center" prop="reason" label="物品金额"></el-table-column>
          <el-table-column align="center" prop="auditUsernameList" label="配送方式"></el-table-column>
          <el-table-column align="center" prop="startTime" label="发货时间"></el-table-column>
          <el-table-column label="操作" width="120" align="center">
            <template #default="scope">
              <el-button type="primary" size="small" link
                         :disabled="scope.row.status!=10" @click="cancel(scope.row.id)">撤销
              </el-button>
            </template>
          </el-table-column>
        </el-table>

      </el-card>
    </el-tab-pane>

  </el-tabs>
</template>

<script setup>
import {onMounted, ref} from "vue";

const multipleSelection = ref([]);
const handleSelectionChange = (val) => {
  multipleSelection.value = val;
}
//定义存放订单列表数据
const tableData = ref([]);
//定义搜索数据
const searchMyPackage = ref({
  mailCode: "",
  packageCode: "",
  getWay: "",
  status: ""
});
const activeName = ref('first');

/*方法*/
//重置搜索
const resetSearch = () => {
  loadMyPackage();
  searchMyPackage.value = {
    mailCode: "",
    packageCode: "",
    getWay: ""
  };
};
//搜索
const loadMyPackage = () => {
  /*axios.get("/api/order/list", {
        params: {
          startTime: searchMyPackage.value.startTime,
          endTime: searchMyPackage.value.endTime,
          code: searchMyPackage.value.code,
          linkedCode: searchMyPackage.value.linkedCode,
          getWay: searchMyPackage.value.getWay,
        },
      })
      .then((res) => {
        tableData.value = res.data.data;
      })*/
}
//进入页面触发
onMounted(() => {
  loadMyPackage();
});
//处理合并方法
const merge = () => {
  
}

</script>



<style scoped>
/* 自定义 tabs 容器样式 */
.custom-tabs {
  /* 调整整体布局或间距 */
  margin-top: 20px;
  margin-left: 20px;
}

/* 使用 :deep() 穿透作用域样式 */
:deep(.el-tabs__nav-wrap::after) {
  /* 移除默认的下边线 */
  background-color: transparent;
}

:deep(.el-tabs__item) {
  /* 调整标签页字体大小、颜色等 */
  font-size: 20px;
  color: grey;
}

:deep(.el-tabs__item.is-active) {
  /* 激活状态下的样式 */
  color: rgb(128, 132, 231);
  font-weight: bold;
}

:deep(.el-tabs__active-bar) {
  /* 调整激活状态下的下划线样式 */
  background-color: rgb(128, 132, 231);
}
</style>